import sendMail from '@/utils/mail'
import { queueConsumer } from '@/utils/rabbit-mq'

export const mailQueueHandle = async () => {
  await queueConsumer(async (msg) => {
    const message = JSON.parse(msg!.content.toString())
    await sendMail(message.to, message.subject, message.html)
  }, 'mail_queue')
}
